# Project:	MapReduce
# Author:	gong_libin
# Date:		2016_06_01

CC ?= g++
CFLAGS ?= -g -Wall

MR_ENV ?= /root/MrJob-2.0.0
MR_BIN ?= $(MR_ENV)/bin
MR_INC ?= $(MR_ENV)/inc
MR_SRC ?= $(MR_ENV)/src

MR_GLIB ?= /usr/lib
MR_GINC ?= /usr/include/MrInc

MR_LIBS =					\
	-lmrglobal				\
	-lpthread

MR_TARGETS =					\
	MrAdapter

MR_OBJECTS =					\
	MrAdapter.o

all: $(MR_OBJECTS) $(MR_TARGETS) install

$(MR_OBJECTS): %.o: %.cpp
	$(CC) -c $(CFLAGS) -I$(MR_GINC) -I$(MR_INC) $< -o $@

$(MR_TARGETS): %: %.o
	$(CC) $(CFLAGS) $(MR_OBJS) $< -o $@ $(MR_LIBS)

install:
	cp $(MR_TARGETS) $(MR_BIN)

clean:
	rm -rf $(MR_OBJECTS)
	rm -rf $(MR_TARGETS)
